package com.novel.constants;

import com.novel.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author tanghao
 * @date 2022/4/16
 */
@Getter
@AllArgsConstructor
public enum ReviewEnum {

    /**
     * 作者 0 小说 1  章节 2 作者签约 3 小说编辑 4 章节编辑 5
     */
    AUTHOR(0, "authorReviewServiceImpl"),

    NOVEL(1, "novelReviewServiceImpl"),

    CHAPTER(2, "chapterReviewServiceImpl"),

    SIGN(3, "signReviewServiceImpl"),

    NOVEL_EDIT(4, "novelEditReviewServiceImpl"),

    CHAPTER_EDIT(5, "chapterEditReviewServiceImpl"),

    ;

    private final Integer type;

    private final String method;

    public static String getMethod(Integer type) {
        for (ReviewEnum reviewEnum : ReviewEnum.values()) {
            if (reviewEnum.getType().equals(type)) {
                return reviewEnum.getMethod();
            }
        }
        throw new BusinessException("不支持的审核类型");
    }

}
